package 集合框架;

import java.util.ArrayList;
import java.util.List;

public class TestArrayList {
    public static void main(String[] args) {
        List<Integer> mylist = new ArrayList<>();
        mylist.add(0,11);
        mylist.add(1,12);
        mylist.add(2,13);
        mylist.add(1,23);
        mylist.add(44);
//        System.out.println(mylist.isEmpty());
//        System.out.println(mylist.contains(2));
        mylist.remove(3);
        System.out.println("元素个数："+mylist.size());
        System.out.println(mylist.get(2));
        System.out.println("截取前：");
        for (Integer i : mylist) {
            System.out.print(i + "\t");
        }
        List<Integer> mylist1 = mylist.subList(0,2);
        System.out.println("\n截取后");
        for(Integer i : mylist1) {
            System.out.print(i+"\t");
        }
        mylist1.remove(0);
        System.out.println("\n删除mylist1元素后");
        for(Integer i : mylist1) {
            System.out.print(i+"\t");
        }
    }
}
